package main

import (
	"log"
	"net/http"
	"net/rpc"
)

type Parms struct {
	Width,Heigh int
}

type Rect struct {

}

func (r *Rect) Area(p Parms,ret *int) error {
	*ret = p.Width * p.Heigh
	return nil
}

func (r *Rect) Perimeter(p Parms,ret *int) error {
	*ret = (p.Heigh + p.Width)*2
	return nil
}

func main() {
	// 1.服务注册
	rect :=  new(Rect)
	rpc.Register(rect)
	rpc.HandleHTTP()

	err := http.ListenAndServe(":8000",nil)
	if err != nil {
		log.Panicln(err)
	}

}
